﻿IF EXISTS (SELECT * FROM sysobjects WHERE type = 'P' AND name = 'usp_UPDMS_FIT_TRAINING_TYPE_Delete')
	BEGIN
		DROP Procedure usp_UPDMS_FIT_TRAINING_TYPE_Delete
	END
GO

SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO
/******************************************************************************
**	Name : usp_UPDMS_FIT_TRAINING_TYPE_Delete
**	Desc : 운동종류관리를 삭제한다.
**	Test Exec Query : Exec usp_UPDMS_FIT_TRAINING_TYPE_Delete
**	Called by : Fit_Dac_UPDMS_FIT_TRAINING_TYPE.cs
**	Program ID : Fit1010m
**	Auth : 송시명
**	Date : 2014-05-19
*******************************************************************************
**	Change History
*******************************************************************************
**	Date:		Author:		Description:
**	--------	--------	---------------------------------------
**	
*******************************************************************************/
CREATE PROC [dbo].[usp_UPDMS_FIT_TRAINING_TYPE_Delete]
@ls_xml nvarchar(max) = '<UPDMS></UPDMS>' --루트노드
AS
BEGIN

DECLARE @iXmlHandle int
EXEC sp_xml_preparedocument @iXmlHandle OUTPUT, @ls_xml

--첨부파일삭제
EXEC usp_UPDMS_COM_FILE_Delete @ls_xml

DELETE FROM UPDMS_FIT_TRAINING_TYPE
 WHERE Seq IN (
         SELECT Seq
           FROM OPENXML(@iXmlHandle, '/UPDMS/UPDMS_FIT_TRAINING_TYPE', 2)
           WITH ( Seq int ) x
       )

--메모리 해제
EXEC sp_xml_removedocument @iXmlHandle

END

GO